package model

import (
	"gorm.io/gorm"
	"user-service/basic/config"
)

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(20)" json:"username"`
	Password string `gorm:"type:varchar(20)" json:"password"`
	Mobile   string `gorm:"type:varchar(20)" json:"mobile"`
}

func (u *User) CreateUser() bool {
	err := config.DB.Create(&u).Error
	if err != nil {
		return false
	}
	return true
}
